<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>审核日志</title>
    <script src="/jquery/jquery-3.2.1.min.js"></script>
    <script src="/layui/layui.js"></script>
    <link rel="stylesheet" href="/layui/css/layui.css">
    <style>
        *{
            margin: 0;
            padding: 0;
        }
        .box{
            width: 100%;
            height: 1030px;
        }
        .list{
            width: 1650px;
            height: 50px;
            margin-left: 20px;
            background-color:rgb(243,243,243);
        }
        .list-left{
            width: 100px;
            height: 30px;
            margin-top: 10px;
            float: left;
        }
        .list-left-left{
            width: 10px;
            height: 30px;
            float: left;
            background: green;
        }
        .list-left-right{
            width: 80px;
            height: 30px;
            font-size: 14px;
            line-height: 30px;
            float: left;
            text-indent: 5px;
        }
        .list-right{
            float: right;
            margin-top: 5px;
            margin-right: 35px;
        }
        .query{
            width: 1650px;
            height: 100px;
            margin-top: 20px;
            margin-left: 20px;
        }
        .layui-col-md11{
            width: 100%;
        }
        .layui-card-header{
            background-color:rgb(243,243,243);
        }
        .query-top-right{
            float: right;
            margin-right: 20px;
        }
        .layui-form-label{
            width: 120px;
        }
        .layui-form-item .layui-input-inline {
            float: left;
            width: 240px;
            margin-right: 50px;
        }
        .record{
            width: 1650px;
            height: 821px;
            margin-top: 40px;
            margin-left: 20px;
            background-color:rgb(243,243,243);
        }
        .import{
            margin-left: 1060px;
        }
        #button_ids{
            display: none;
        }
        .layui-table-cell {
            line-height: 47px;
            height: inherit;
        }
        .layui-table-cell>a{
            color:green;
        }
        .layui-table-fixed {
            position: absolute;
            left: 0px;
            top: 0px;
            z-index: 101;
        }
        div#rMenu {position:absolute; visibility:hidden; top:0; background-color: #555;text-align: left;padding: 2px;}
        div#rMenu ul li {
            margin: 1px 0;
            padding: 0 5px;
            cursor: pointer;
            list-style: none outside none;
            background-color: #DFDFDF;
        }
        img{
            width: 100px;
            height: 116px;
        }
        .layui-table, .layui-table-view {
            margin: 10px 20px;
        }
    </style>
</head>
<body>
<div class="box">
    <!--商品列表-->
    <div class="list">
        <div class="list-left">
            <div class="list-left-left"></div>
            <p class="list-left-right">审核日志</p>
        </div>
        <div class="list-right">
            <div class="list-right-left layui-btn layui-icon layui-icon-refresh" onclick="refresh()">&nbsp;刷新</div>
            <div class="list-right-right layui-btn layui-icon layui-icon-left" id="goBack">&nbsp;返回</div>
        </div>
    </div>

    <!--筛选查询-->
    <div class="layui-row query">
        <div class="layui-col-md11">
            <div class="layui-card headerCenter">
                <div class="layui-card-header backColor">
                    <i class="layui-icon">&#xe615;</i>
                    筛选查询
                </div>
                <div class="layui-card-body">
                    <form class="layui-form">
                        <div class="layui-form-item">
                            <label class="layui-form-label">审核人：</label>
                            <div class="layui-input-inline">
                                <input type="text" name="userName" class="layui-input" placeholder="请输入审核人"/>
                            </div>

                            <label class="layui-form-label">审核结果：</label>
                            <div class="layui-input-inline">
                                <select class="layui-select" name="type"  id="type" value="请选择审核结果">
                                    <option value=""></option>
                                    <option value="1">审核通过</option>
                                    <option value="3">审核驳回</option>
                                </select>
                            </div>

                            <label class="layui-form-label">审核时间：</label>
                            <div class="layui-input-inline">
                                <input type="text" name="createDate" id="createDate" class="layui-input" placeholder="请选择审核时间"/>
                            </div>

                            <span style="float: right;margin-right: 20px">
                                <button type="button" class="layui-btn" onclick="search()">
                                    <i class="layui-icon layui-icon-search"></i> 搜索
                                </button>
                                <button type="reset" class="layui-btn layui-btn-warm">
                                    <i class="layui-icon layui-icon-refresh-3"></i> 重置
                                </button>
                            </span>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
    <!--数据列表-->
    <div class="record">
        <!--表-->
        <table id="demoTable" lay-filter="demoTable"></table>
    </div>
    <!--表头样式-->
    <div id="button_ids">
        <i class="layui-icon layui-icon-align-left"></i> 审核日志列表
    </div>
    <!--表内操作-->
    <div id="button_caozuo" style="display:none" >
        <a alt="删除" title="删除" lay-event="deleteTable">删除</a>
    </div>
</div>

<p id="title" style="display: none;">审核日志</p>

<script>
</script>
<script>
    layui.use(['jquery','layer','table','laydate'],function(){
        var $=layui.jquery;
        var layer=layui.layer;
        var table=layui.table;
        var laydate = layui.laydate;

        //绑定时间格式
        laydate.render({
            elem: '#createDate',
            type: 'datetime',
            trigger: 'click'
        })

        getTable();
        //返回按钮
        $('#goBack').click(function () {
            var title = $('#title').text();
            var iframe = parent.$('.iframe');
            $.each(iframe,function (i,item) {
                if($(item).attr('quickEntry') != undefined){
                    parent.$('#quickEntryIndex').val('首页');
                    parent.$(this).attr('quickEntryIndex','首页');
                    parent.quickEntryIndex();
                    return false;
                }
                if(title == $(item).attr('_href')){
                    parent.$('#beforeHref').val($(item).attr('_href'));
                    parent.beforeHref();
                    return false;
                }
            });
        });
        function getTable() {
            $.ajax({
                url: '/JsAuditLog/getJsAuditLogListAll',
                type: 'post',
                dataType: 'json',
                success: function (data) {
                    demoTable(data.data);
                }
            })
        }

        search = function search() {
            var userName = $("input[name=userName]").val();
            var type = $("#type option:selected").text();
            var newType;
            if(type=="审核通过"){
                newType=1
            }else if(type=="审核驳回"){
                newType=3
            }
            var createDate = $("input[name=createDate]").val();
            getTableByCondition(userName,newType,createDate);
        }

        function getTableByCondition(userName,newType,createDate){
            $.ajax({
                url: '/JsAuditLog/getJsAuditLogListAll',
                type: 'post',
                dataType: 'json',
                data: {"userName":userName,"type":newType,"createDate":createDate},
                success: function (data) {
                    demoTable(data.data);
                }
            })
        }
        /*表格*/
        function demoTable(data){
            table.render({
                elem:'#demoTable',
                title:"数据列表",
                data:data,
                toolbar:'#button_ids',
                limit:10,
                width:1610,
                page:{
                    layout:['count','prev','page','next','limit','skip','refresh'],
                    limits:[10,20,50],
                    first:"首页",
                    last:"尾页",
                },
                cols:[[
                    {type:"checkbox",float:"left"},
                    {title:"序号",align:'center',width:173,templet:function (data) {
                        return data.LAY_INDEX;
                    }},
                    {field:"examineType",title:"审核类型",align:'center',width:230,templet:function (data) {
                        if(data.examineType==2){
                            return "课程"
                        }else if(data.examineType==3){
                            return "商品"
                        }else if(data.examineType==4){
                            return "用户"
                        }else if(data.examineType==5){
                            return "微圈"
                        }
                    }},
                    {field:"type",title:"审核结果",align:'center',width:230,templet:function (data) {
                        if(data.type==1){
                            return "审核通过"
                        }else if(data.type==3){
                            return "审核驳回"
                        }
                    }},
                    {field:"userName",title:"审核人",align:'center',width:230},
                    {field:"createDate",title:"审核时间",align:'center',width:230},
                    {field:"remark",title:"备注",align:'center',width:230,templet:function (data) {
                            if(data.remark==null||data.remark==""){
                                return "无"
                            }else{
                                return data.remark
                            }
                        }},
                    {field:'',title:"操作",align:'center',width:230,toolbar:'#button_caozuo'}
                ]]
            })
        }


        table.on('tool(demoTable)',function (obj) {
            var event = obj.event;
            if (event == "deleteTable"){
                layer.confirm('确认要删除吗?', {icon: 3, title:'提示'}, function(index){
                    $.ajax({
                        url: '/JsAuditLog/deleteJsAuditLog',
                        data: {'auditLogId':obj.data.auditLogId},
                        type:'post',
                        dataType:'json',
                        success:function (data) {
                            layer.msg("已删除");
                            getTable();
                        }
                    })
                    layer.close(index);
                });
            }
        })

        refresh=function refresh(){
            location.reload();
        }

        //返回按钮
        $('#goBack').click(function () {
            var title = $('#title').text();
            var iframe = parent.$('.iframe');
            $.each(iframe,function (i,item) {
                if(title == $(item).attr('_href')){
                    parent.$('#beforeHref').val($(item).attr('_href'));
                    parent.beforeHref();
                    return;
                }
            });
        });

    })
</script>
</body>
</html>